import { defineStore } from 'pinia'
export const user =defineStore({
	id:'user',
	state() {
		return{
			uservalue:'储存用户信息',
			age:18,
			list:[]
		}
	},
	getters:{
		getage(){
			return this.age+'pinia的计算属性'
		}
	},
	actions:{
		//pinia里面没有mutations  actions可以用作同步也可以用作异步
		changeNum(val){
			console.log(val)
			setTimeout(()=>{
				this.age+=val.number
				this.list=val.list
				this.uservalue=val.user
			}, 2000);
			
		}
	}
})